package io.renren.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.entity.XlsBanksEntity;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.dao.XlsBanksDao;
import io.renren.dto.XlsBanksDTO;
import io.renren.service.XlsBanksService;
import io.renren.utils.AppResult;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 银行表
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2020-04-12
 */
@Service
public class XlsBanksServiceImpl extends CrudServiceImpl<XlsBanksDao, XlsBanksEntity, XlsBanksDTO> implements XlsBanksService {

    @Autowired
    private XlsBanksDao xlsBanksDao;

    @Override
    public QueryWrapper<XlsBanksEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<XlsBanksEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);

        return wrapper;
    }


    @Override
    public AppResult selectBanksList() {
        Map<String,Object> map=new HashMap<>();
        List<XlsBanksEntity> xlsBanksEntities = xlsBanksDao.selectByMap(map);
        return AppResult.OK(xlsBanksEntities);
    }
}